home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998…tember: Reference Library / Dev.CD Sep 98 RL1.toast / Technical Documentation / develop / develop Issue 27 / develop Issue 27 code / Internet Config Assistant / toolkit / TApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-30  |  2.1 KB  |  77 lines  |  [TEXT/CWIE]

  1. /*
  2.   File:            TApplication.h
  3.  
  4.   Contains:        TApplication: a class for applications with no document
  5.  
  6.   Written by:     Arno Gourdol
  7.  
  8.   Copyright:    © 1993-1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #pragma once
  13.  
  14. #include <Quickdraw.h>
  15. #include <AppleEvents.h>
  16.  
  17. #include "TEnvironment.h"
  18. #include "CWindows.h"
  19.  
  20. class TApplication
  21. {
  22. public:
  23.     // constructor
  24.     TApplication(OSType signature);
  25.  
  26.     // destructor
  27.     virtual ~TApplication();
  28.  
  29.     virtual void Run(void);                        // Starts the app
  30.     virtual Boolean QuitRequested(void);        // Can we quit?
  31.     virtual void Quit();                        // Clean-up, get ready to quit
  32.     virtual void AppActivated(Boolean active);    // Change the activation state (dim controls, etc...)
  33.     virtual void AboutRequested(void);            // Display About box
  34.  
  35.     virtual void Pulse(void);                    // Idle event
  36.  
  37.     // Menu commands
  38.     virtual void MenusWillShow(void);            // Update the menus
  39.     virtual Boolean MenuCommand(short menu,
  40.                                 short item);
  41.  
  42.     static TApplication* gApplication;            // The running application
  43.     Boolean fFinished;                            // True if the application must quit
  44.  
  45.     // Environment
  46.     TEnvironment fEnvironment;                    // Info about what system software is available
  47.  
  48. protected:
  49.     void MainEventLoop(void);                    // Get and process events
  50.  
  51.     // Update and Drawing
  52.     virtual void Event(const EventRecord& evt);    // Process an event (and dispatch)
  53.  
  54.     // Apple Events
  55.     virtual void InitAppleEvents(void);
  56.     virtual OSErr Event(AppleEvent *messagein, AppleEvent *reply, OSType eventID);
  57.  
  58.     // UI behavior
  59.     Boolean DoZoomWindow(short part);            // ZoomWindow in or out
  60.     Boolean DoResizeWindow(struct EventRecord *evt);                // Resize the window
  61.     void DoUpdateDocument(RgnHandle area);        // Update the area region of the content of the document
  62.  
  63.     // Events
  64.     UInt32 fSleepTime;                            // Background sleep time passed to WNE
  65.  
  66.     // State of the application
  67.     Boolean fActive;                            // True if window is active
  68.  
  69.     
  70.     OSType fSignature;                            // Application signature
  71.     
  72. private:
  73.     void HandleMenuCommand(long command);        // Dispatch menu commands
  74.     static pascal Boolean IdleProc(EventRecord *event, long *sleep, RgnHandle *mouseRgn);
  75.     static pascal OSErr HandleAppleEvent(AppleEvent *messagein, AppleEvent *reply, OSType eventID);
  76. };
  77.